package com.tycmc.signelectroniccontracts.tools.adapter.recyclerview;

import android.content.Context;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;


public class RecyclerTool {
    public static LinearLayoutManager setListView(Context context, boolean isvertical){

            LinearLayoutManager layoutManager =new LinearLayoutManager(context);
            layoutManager.setOrientation(isvertical?LinearLayoutManager.VERTICAL:LinearLayoutManager.HORIZONTAL);
//            recyclerView.setLayoutManager(layoutManager);
      return  layoutManager;
    }

    public static LinearLayoutManager setListView(Context context) {
        return  setListView(context,true);
    }

    public static void setGridView(Context context, RecyclerView recyclerView, int num){
        GridLayoutManager layoutManager = new GridLayoutManager(context,num);
        recyclerView.setLayoutManager(layoutManager);
//        recyclerView.addItemDecoration(new RecycleViewDivider(context,LinearLayoutManager.HORIZONTAL,4, Color.RED));
//        recyclerView.addItemDecoration(new RecycleViewDivider(context,LinearLayoutManager.VERTICAL,10,Color.BLACK));
    }
}
